import { HTTP } from '../../common/js/http.js'

import util from '../../common/js/util.js'

export class discoverModel extends HTTP {
	getLocation() {
		return new Promise((resolve, reject) => {
			uni.getLocation({
				type: 'wgs84',
				success: (res) => {
					res.latitude = Number(res.latitude.toString().match(/^\d+(?:\.\d{0,6})?/));
					res.longitude = Number(res.longitude.toString().match(/^\d+(?:\.\d{0,6})?/));
					resolve(res)
				},
				fail: (res) => {
					reject(res)
				}
			})
		})
	}

	getIndexData(res) {
		return this.request({
			url: 'api/Discovery/GetDiscoveryHome',
			data:{
				disLng: res.longitude,
				disLat: res.latitude
			}
		})
	}
}
